OSNAME!=/usr/bin/uname

.if ${OSNAME} == "OpenBSD"
CC=/usr/bin/cc
CFLAGS=-W -Wall -ansi -pedantic -g
.elif ${OSNAME} == "SunOS"
CC=/usr/gnu/bin/cc
CFLAGS=-W -Wall -ansi -pedantic -g
LDADD=-lsocket -lnsl
.else
	@echo "Operating system not suported";
.endif

gopehrd: gopherd.c
	$(CC) $(CFLAGS) $(LDADD) gopherd.c gfw.c -o gopherd


gfwtest: gfwtest.c gfw.c
	$(CC) $(CFLAGS) gfwtest.c gfw.c -o gfwtest

gdiff:
	-diff -cu cvs/gopherd.h gopherd.h
	-diff -cu cvs/gopherd.c gopherd.c
	-diff -cu cvs/gopherd.sh gopherd.sh
	-diff -cu cvs/gfw.c gfw.c
	-diff -cu cvs/gfw.h gfw.h
	-diff -cu cvs/Makefile Makefile
	-diff -cu cvs/README README

clean:
	-rm gfwtest gopherd

dist:
	@tar -s '#cvs#gopherd#' -czvhf gopherd.tgz cvs/
	install -m 644 gopherd.tgz /var/nginx/html/
	@rm gopherd.tgz
